
score_id = 2;

feat_id = [1 5 9];

method_cand = [1 2 7 8];

genNameList;

score_mat = zeros( length(method_cand),3);

sparse_dim = 15;

for i = 1:length(method_cand)
    method_id = method_cand(i);
    vali_name = [ './vali_result/vali_exp_sel_' ...
        num2str(sparse_dim) '_' ...
        method_name{method_id} '_feat' ];

    for k = feat_id
        vali_name = [vali_name num2str( k ) ];
    end

    vali_name = [vali_name '_on_' ...
                score_name{score_id} '.mat'];

    try
        load(vali_name,'vali');
    catch
        continue;
    end

    if(length(vali)<3), continue, end

    pick_k = 19;

    for j = 1:length(vali);
        score_mat(i,j) = vali{j}.act_F_res( pick_k );            
    end
end


fid = fopen('TableSparse.tex','wt');

fprintf(fid,'\\begin{table}[tb]\n');
fprintf(fid,'\t\\footnotesize\n');
fprintf(fid,'\t\\centering\n');
fprintf(fid,'\t\\caption{Recommendation with Sparse Probe}\n');
fprintf(fid,'\t\\label{glb_feats}\n');
fprintf(fid,'\t\\begin{tabular}{| l |');
for i = 1:size(score_mat,1) -1
    fprintf( fid ,'c|');
end
fprintf(fid,'}\n');
fprintf(fid,'\t\\hline\n');
fprintf(fid,['\t'...            
            '\t& EDSH '...
            '\t& kitchen	'...
            '\\\\ \\hline\n']);
        
for i = 1:length(method_cand)
    fprintf(fid,'\t%s ',method_name{ method_cand(i) });
    
    for j = 2:3
        if(score_mat(i,j)>0.1)
            fprintf(fid,'\t & %.3f ',score_mat(i,j));
        else
            fprintf(fid,'\t & NaN ',score_mat(i,j));
        end            
    end
    
    fprintf(fid,'\\\\\\hline\n');
    
end

fprintf(fid,'\t\\end{tabular}\n');
fprintf(fid,'\t\\vspace{-4mm}\n');
fprintf(fid,'\\end{table}\n');

fclose(fid);